package br.inf.prismasoft.academix.entity;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.hibernate.validator.NotNull;

/**
 * GradeCurricular generated by hbm2java
 */
@Entity
@Table(name = "GRADE_CURRICULAR", schema = "ACADEMIX", uniqueConstraints = @UniqueConstraint(columnNames = {
		"num_ano", "num_semestre", "num_periodo_vigente", "ind_curso" }))
public class GradeCurricular implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2281453474264566089L;
	private Integer idtGradeCurricular;
	private Curso curso;
	private int numAno;
	private int numSemestre;
	private int numPeriodoVigente;
	private Set<Turma> turmas = new HashSet<Turma>(0);
	private Set<DiscGradeCurricular> discGradeCurriculars = new HashSet<DiscGradeCurricular>(
			0);

	public GradeCurricular() {
	}

	public GradeCurricular(Curso curso, int numAno, int numSemestre,
			int numPeriodoVigente) {
		this.curso = curso;
		this.numAno = numAno;
		this.numSemestre = numSemestre;
		this.numPeriodoVigente = numPeriodoVigente;
	}

	public GradeCurricular(Curso curso, int numAno, int numSemestre,
			int numPeriodoVigente, Set<Turma> turmas,
			Set<DiscGradeCurricular> discGradeCurriculars) {
		this.curso = curso;
		this.numAno = numAno;
		this.numSemestre = numSemestre;
		this.numPeriodoVigente = numPeriodoVigente;
		this.turmas = turmas;
		this.discGradeCurriculars = discGradeCurriculars;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "idt_grade_curricular", unique = true, nullable = false)
	public Integer getIdtGradeCurricular() {
		return this.idtGradeCurricular;
	}

	public void setIdtGradeCurricular(Integer idtGradeCurricular) {
		this.idtGradeCurricular = idtGradeCurricular;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ind_curso", nullable = false)
	@NotNull
	public Curso getCurso() {
		return this.curso;
	}

	public void setCurso(Curso curso) {
		this.curso = curso;
	}

	@Column(name = "num_ano", nullable = false)
	@NotNull
	public int getNumAno() {
		return this.numAno;
	}

	public void setNumAno(int numAno) {
		this.numAno = numAno;
	}

	@Column(name = "num_semestre", nullable = false)
	@NotNull
	public int getNumSemestre() {
		return this.numSemestre;
	}

	public void setNumSemestre(int numSemestre) {
		this.numSemestre = numSemestre;
	}

	@Column(name = "num_periodo_vigente", nullable = false)
	@NotNull
	public int getNumPeriodoVigente() {
		return this.numPeriodoVigente;
	}

	public void setNumPeriodoVigente(int numPeriodoVigente) {
		this.numPeriodoVigente = numPeriodoVigente;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "gradeCurricular")
	public Set<Turma> getTurmas() {
		return this.turmas;
	}

	public void setTurmas(Set<Turma> turmas) {
		this.turmas = turmas;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "gradeCurricular")
	public Set<DiscGradeCurricular> getDiscGradeCurriculars() {
		return this.discGradeCurriculars;
	}

	public void setDiscGradeCurriculars(
			Set<DiscGradeCurricular> discGradeCurriculars) {
		this.discGradeCurriculars = discGradeCurriculars;
	}

}
